package com.yjc.rabbitMQ.six;

import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;
import com.yjc.rabbitMQ.utils.RabbitMQUtils;

import java.util.function.BinaryOperator;

/**
 * @author shkstart
 * @create 2022-08-02 8:49
 */
public class EmitLogsDirect {

    private final static String EXCHANGE_NAME = "direct_logs";

    public static void main(String[] args) throws Exception {
        System.out.println("EmitLogsDirect发送消息中......");

        Channel channel = RabbitMQUtils.getChannel();
        channel.exchangeDeclare(EXCHANGE_NAME, BuiltinExchangeType.DIRECT);
        channel.basicPublish(EXCHANGE_NAME, "error", null, ("你好error *(￣▽￣)~").getBytes("UTF-8"));
        channel.basicPublish(EXCHANGE_NAME, "info", null, ("你好info *(￣▽￣)~").getBytes("UTF-8"));
        channel.basicPublish(EXCHANGE_NAME, "warning", null, ("warning *(￣▽￣)~").getBytes("UTF-8"));
    }
}
